﻿package mortal.game.view.copy.sixBoss.renderer
{
    import com.mui.controls.*;
    import com.mui.utils.*;
    import flash.geom.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.copy.sixBoss.data.*;
    import mortal.mvc.core.*;

    public class SixBossRewardCellRenderer extends GCellRenderer
    {
        private var _rewardItem:BaseItem;
        private var _rewardInfo:SixBossOutPutRewardInfo;

        public function SixBossRewardCellRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._rewardItem = UICompomentPool.getUICompoment(BaseItem);
            this._rewardItem.setItemStyle(ItemStyleConst.Big, "", 2, 2);
            this._rewardItem.isShowPrescritime = false;
            this._rewardItem.isDragAble = false;
            this.addChild(this._rewardItem);
            Dispatcher.addEventListener(EventName.SixBossGetReward, this.onGetRewardHandler);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._rewardInfo = param1 as SixBossOutPutRewardInfo;
            if (this._rewardInfo)
            {
                this._rewardItem.itemCode = this._rewardInfo.itemCode;
                this._rewardItem.amount = this._rewardInfo.itemAmount;
            }
            return;
        }// end function

        private function onGetRewardHandler(event:DataEvent) : void
        {
            var _loc_2:* = this._rewardItem.localToGlobal(new Point(0, 0));
            FlyToNavbarTool.flyToBackPack(this._rewardItem.bitmapdata, _loc_2);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl();
            this._rewardItem.dispose();
            this._rewardItem = null;
            this._rewardInfo = null;
            Dispatcher.removeEventListener(EventName.SixBossGetReward, this.onGetRewardHandler);
            return;
        }// end function

    }
}
